void swap(int* a, int* b)
{
	int tmp = *a;
	*a = *b;
	*b = tmp;
}

void BubbleSort(int* a, int n)
{
	int i = 1, j = 1;
	for (j = 1; j <= n; j++)
	{
		int exchange = 0;
		for (i = 1; i <= n - j; i++)
		{
			if (a[i - 1] > a[i])
			{
				swap(&a[i], &a[i - 1]);
				exchange = 1;
			}
			if (exchange == 0)
			{
				break;
			}
		}
	}
}